WebWork 2.2.6 and above

This feature is only available for WebWork 2.2.6 and above

A StartUpListener and ShutDownListener could defined such that WebWork will called them when its starting up and shutting down respectively. The StartUpListener and ShutDownListener_ are being defined in webwork.properties

They are basically hooked up through FilterDispatcher's init() and cleanup() method which in turns is invoked by FilterDispatcher's init() and destroy() methods respectively.

### A start up listener class name (must implements com.opensymphony.webwork.dispatcher.StartUpListener
### interface) that will get invoked only once when WebWork started up. The class names could be
### comma separated and will be executed in order.
#
#webwork.dispatcher.startUpListener=foo.bar.StartUpListener1, foo.bar.StartUpListener2

### A shut down listener class name (must implements com.opensymphony.webwork.dispatcher.ShutDownListener
### interface) that will get invoked only once when WebWork shuts down.  The class names could be
### comma separated and will be executed in order.
#
#webwork.dispatcher.shutDownListener=foo.bar.ShutDownListener1, foo.bar.ShutDownListener2

StartUpListener

An interface to be implemented if require to get informed when WebWork starts up, It's being hooked up through FilterDispatcher#init(javax.servlet.FilterConfig) -> DispatcherUtils#init(javax.servlet.ServletContext) methods calls.

It can be configured through webwork.properties that resides in the classpath, typically in /WEB-INF/classes directory through the following entry

webwork.dispatcher.startUpListener=foo.bar.StartupListener1, foo.bar.StartupListener2

The value of the properties is the FQN (Fully Quantified class name of the start up listeners) It must implements this interface, else a ClassCastException will be registered in the log. Multiple class names could be specified, but they must be comma separated.

StartUpListener looks as follows :-

public interface StartUpListener {
	void startup();
}

ShutDownListener

An interface to be implemented if require to get informed when WebWork shuts down, It's being hooked up through FilterDispatcher#destroy() -> DispatcherUtils#cleanup() methods calls.

It can be configured through webwork.properties that resides in the classpath, typically in /WEB-INF/classes directory through the following entry

webwork.dispatcher.shutDownListener=foo.bar.ShutdownListener1, foo.bar.ShutdownListener2

The value of the properties is the FQN (Fully Quantified class name of the shut down listeners) It must implements this interface, else a ClassCastException will be registered in the log. Multiple class names could be specified, but they must be comma separated.

ShutDownListener looks as follows :-

public interface ShutDownListener {
	void shutdown();
}